
package com.thinkgsp.jxc.model;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.thinkgsp.util.XlsFieldAnnotation;

/**
 * 客户类
 * @author evan
 *
 */
public class Customer extends BaseModel implements Serializable {

	private static final long serialVersionUID = -356874010385006863L;

	private Integer customerId;
	private Integer parentId;
	@XlsFieldAnnotation(ChsName="客户编号",MethodName="getCustomerCode")
	private String customerCode;
	@XlsFieldAnnotation(ChsName="客户名称",MethodName="getCustomerName")
	private String customerName;
	private Integer custType = 3;
	private String contactMan;
	private String telephone;
	private String mobilephone;
	private String qqNumber;
	private String email;
	private String address;
	private String deliveryAdd;
	private Integer deptId;
	private Integer empId;
	private Integer creditAmount = 0;
	private Integer creditDay = 0;
	private Boolean acctLocked = false;
	private Boolean acctExpired = false;
	private Boolean acctEnabled = false;
	private Boolean deleted = false;
	private String sfdaCode;
	private String remark;
	
	private Customer parentCustomer;
	private Emp emp;
	private Dept dept;
	
	
	public Customer getParentCustomer() {
		return parentCustomer;
	}

	public void setParentCustomer(Customer parentCustomer) {
		this.parentCustomer = parentCustomer;
		this.parentId = parentCustomer.getCustomerId();
	}

	public Emp getEmp() {
		return emp;
	}

	public void setEmp(Emp emp) {
		this.emp = emp;
		this.empId = emp.getEmpId();
	}

	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
		this.deptId = dept.getDeptId();
	}

	/**
	 * 客户ID
	 * @return
	 */
	public Integer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	/**
	 * 上级客户ID
	 * @return
	 */
	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	/**
	 * 客户编码
	 * @return
	 */
	public String getCustomerCode() {
		return customerCode;
	}

	public void setCustomerCode(String customerCode) {
		this.customerCode = customerCode;
	}

	/**
	 * 客户名称
	 * @return
	 */
	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	/**
	 * 客户类型(1 : 客户;2 : 供货商;3 : 客户与供货商)
	 * @return
	 */
	public Integer getCustType() {
		return custType;
	}

	public void setCustType(Integer custType) {
		this.custType = custType;
	}

	/**
	 * 联系人
	 * @return
	 */
	public String getContactMan() {
		return contactMan;
	}

	public void setContactMan(String contactMan) {
		this.contactMan = contactMan;
	}

	/**
	 * 联系电话
	 * @return
	 */
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	/**
	 * 手机
	 * @return
	 */
	public String getMobilephone() {
		return mobilephone;
	}

	public void setMobilephone(String mobilephone) {
		this.mobilephone = mobilephone;
	}

	/**
	 * QQ号
	 * @return
	 */
	public String getQqNumber() {
		return qqNumber;
	}

	public void setQqNumber(String qqNumber) {
		this.qqNumber = qqNumber;
	}

	/**
	 * 邮箱地址
	 * @return
	 */
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * 地址
	 * @return
	 */
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * 收货地址
	 * @return
	 */
	public String getDeliveryAdd() {
		return deliveryAdd;
	}

	public void setDeliveryAdd(String deliveryAdd) {
		this.deliveryAdd = deliveryAdd;
	}

	/**
	 * 负责部门ID
	 * @return
	 */
	public Integer getDeptId() {
		return deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	/**
	 * 负责职员
	 * @return
	 */
	public Integer getEmpId() {
		return empId;
	}

	public void setEmpId(Integer empId) {
		this.empId = empId;
	}

	/**
	 * 信用金额
	 * @return
	 */
	public Integer getCreditAmount() {
		return creditAmount;
	}

	public void setCreditAmount(Integer creditAmount) {
		this.creditAmount = creditAmount;
	}

	/**
	 * 信用天数
	 * @return
	 */
	public Integer getCreditDay() {
		return creditDay;
	}

	public void setCreditDay(Integer creditDay) {
		this.creditDay = creditDay;
	}

	/**
	 * 账户锁定
	 * @return
	 */
	public Boolean getAcctLocked() {
		return acctLocked;
	}

	public void setAcctLocked(Boolean acctLocked) {
		this.acctLocked = acctLocked;
	}

	/**
	 * 账户过期
	 * @return
	 */
	public Boolean getAcctExpired() {
		return acctExpired;
	}

	public void setAcctExpired(Boolean acctExpired) {
		this.acctExpired = acctExpired;
	}

	/**
	 * 账户启用状态,本属性不用，使用deleted代替
	 * @return
	 */
	@Deprecated
	public Boolean getAcctEnabled() {
		return acctEnabled;
	}
	@Deprecated
	public void setAcctEnabled(Boolean acctEnabled) {
		this.acctEnabled = acctEnabled;
	}

	/**
	 * 删除标志
	 * @return
	 */
	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	/**
	 * 许可证号
	 * @return
	 */
	public String getSfdaCode() {
		return sfdaCode;
	}

	public void setSfdaCode(String sfdaCode) {
		this.sfdaCode = sfdaCode;
	}

	/**
	 * 备注
	 * @return
	 */
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#toString()
	 */
	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("customerId",this.customerId)
		  .append("customerCode",this.customerCode)
		  .append("customerName",this.customerName);
		
		return sb.toString();
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof Customer)) {
			return false;
		}
		final Customer cust = (Customer)o;
		if(customerId != null) {
			return customerId.equals(cust.getCustomerId());
		} else {
			return cust.getCustomerId() == null;
		}
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#hashCode()
	 */
	@Override
	public int hashCode() {
		return (this.customerId != null ? this.customerId.hashCode() : 0);
	}

}
